package api_day07;

import java.util.HashMap;

/*
 * 课堂练习
 */
public class ClassWork1 {
    public static void main(String[] args) {
        //work1
        String[] province = {"黑龙江省","浙江省","江西省","广东省","福建省"};
        String[] city = {"哈尔滨","杭州","南昌","广州","福州"};
        HashMap<String,String> map1 = new HashMap<>();
        for (int i = 0; i < province.length; i++) {
            map1.put(province[i],city[i]);
        }
        System.out.println(map1);
        //work2
        StringBuilder sb = new StringBuilder("Hello World!");
        HashMap<Character,Integer> map2 = new HashMap<>();
        for (int i = 0; i < sb.length(); i++) {
            char c = sb.charAt(i);
            if (map2.containsKey(c)) map2.put(c,map2.get(c) + 1);
            else map2.put(c,1);
        }
        System.out.println(map2);
    }
}
